import java.util.Arrays;

public class ShuZhu {
    public static void main(String[] args) {
        /*int score1 = 61;
        int score2 = 78;
        int score3 = 88;
        int score4 = 99;
        int score5 = 89;
        int score6 = 75;
        System.out.println(score1);
        System.out.println(score2);
        System.out.println(score3);
        System.out.println(score4);
        System.out.println(score5);
        System.out.println(score6);*/
        //第一种创建方式
        //int[] arr1 = new int[10];
        //第二种创建方式
        //int[] arr2 = new int[]{1,5,6,8,9};
        //第三种创建方式
        //int[] arr3 = {2,4,6,8,10};
        /*int[] arr1 = new int[5];
        double[] arr2 = new double[5];
        boolean[] arr3 = new boolean[5];
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arr2));
        System.out.println(Arrays.toString(arr3));*/
        //int[] arr1 = new int[]{1,3,5,7,9};
        //输出下标为0的对应的值
        //System.out.print(arr1[0] + " ");
        //输出下标为1的对应的值
        //System.out.print(arr1[1] + " ");
        //输出下标为2的对应的值
        //System.out.print(arr1[2] + " ");
        //输出下标为3的对应的值
        //System.out.print(arr1[3] + " ");
        //输出下标为4的对应的值
        //System.out.print(arr1[4] + " ");
        /*arr1[2] = 100;
        System.out.println(arr1[2]);*/
        /*int[] arr = new int[10];//创建一个int类型的数组，长度是10
        for (int x:arr) {//循环遍历，把arr中发值给x
            System.out.print(x + " ");//输出x
        }*/
        //循环遍历数组的每一个下标，length可以用来求数组的长度
        /*for (int i = 0; i < arr.length; i++) {
            //每次把i给arr下标i
            arr[i] = i;
            //输出arr[i]
            System.out.print(arr[i] + " ");
        }*/
        /*int a = 10;
        int b = 20;
        int[] arr = new int[]{1,2,3};
        System.out.println(a);
        System.out.println(b);
        System.out.println(Arrays.toString(arr));*/
       /* int[] arr = null;
        int[] arr1 = {0};
        int[] arr2 = new int[0];
        System.out.println(arr);
        System.out.println(arr1);
        System.out.println(arr2);*/
        /*int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = i;//把i存到数组中
            System.out.print(arr[i] + " ");//打印一下
        }
        System.out.println();
        System.out.print(Arrays.toString(arr));*/
        /*int a = 10;
        fanec(a);
        System.out.println(a);
        System.out.println("-----------------------");
        int[] arr = {1,2,3};
        fanec(arr);
        System.out.println(Arrays.toString(arr));*/
        int[] array = feibo(10);//把feibo的值给数组array，feibo本身返回的要是一个数组

        for (int i = 0; i < array.length; i++) {
            //循环输出数组array里面的值
            System.out.print(array[i] + " ");
        }
    }
    public static int[] feibo(int n) {
        //判断是否为空
        if(n <= 0) {
            return null;
        }
        //定义一个数组
        int[] array = new int[n];
        array[0] = 1;//第一项
        array[1] = 1;//第二项
        //从第三项开始，到第十项
        for (int i = 2; i < array.length; ++i) {
            //把前面两项之和给第三项，得到1---10的值
            array[i] = array[i - 1] + array[i -2];
        }
        return array;//返回这个数组
    }
    //参数是整型的fanec
   /* public static void fanec(int x) {
        x = 100;
        System.out.println(x);
    }
    //参数是数组的fanec
    public static void fanec(int[] x) {
        x[1] = 21;
        System.out.println("x = " + x[1]);
    }*/
}
